package com.example.blogindex.web;

import com.example.blogindex.web.Fengin.OtherFengin;
import com.xpd.blog.bean.Comment;
import com.xpd.blog.bean.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("commetn")
public class CommentController {
    @Autowired
    OtherFengin otherFengin;
    @RequestMapping("selectByid")
    List<Comment> selectByid(@RequestParam int bid){
        List<Comment> comments = otherFengin.selectByid(bid);
        return comments;
    }
    @RequestMapping("insertComment")
    Result insertComment(@RequestBody Comment comment, @RequestParam int usid, @RequestParam int bid){
        Result result = otherFengin.insertComment(comment, usid, bid);
        return  result;
    }

}
